package com.ljh.jxc.modules.suo.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ljh.jxc.modules.suo.entity.Receiptdetail;
import com.ljh.jxc.service.ReceiptdetailService;
import com.ljh.jxc.common.utils.PageUtils;
import com.ljh.jxc.common.utils.R;



/**
 * 收款明细单
 *
 * @author liujinghui
 * @email liujinghui@163.com
 * @date 2021-12-01 13:49:03
 */
@RestController
@RequestMapping("jxc/receiptdetail")
public class ReceiptdetailController {
    @Autowired
    private ReceiptdetailService receiptdetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxc:receiptdetail:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = receiptdetailService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{receiptdetailId}")
    @RequiresPermissions("jxc:receiptdetail:info")
    public R info(@PathVariable("receiptdetailId") String receiptdetailId){
		Receiptdetail receiptdetail = receiptdetailService.getById(receiptdetailId);

        return R.ok().put("receiptdetail", receiptdetail);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxc:receiptdetail:save")
    public R save(@RequestBody Receiptdetail receiptdetail){
		receiptdetailService.save(receiptdetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxc:receiptdetail:update")
    public R update(@RequestBody Receiptdetail receiptdetail){
		receiptdetailService.updateById(receiptdetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxc:receiptdetail:delete")
    public R delete(@RequestBody String[] receiptdetailIds){
		receiptdetailService.removeByIds(Arrays.asList(receiptdetailIds));

        return R.ok();
    }

}
